package com.tdkj.model.shop;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import com.tdkj.model.base.BaseEntity;
import com.tdkj.model.user.BeanUser;

/**
 * ShoppingCart entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "shop_shopping_cart")
public class BeanShoppingCart extends BaseEntity {

	private String state;
	private BeanUser user;
	
	private List<BeanShoppingCartItem> items = new ArrayList<BeanShoppingCartItem>();
	
	/**
	 * @return the state
	 */
	public String getState() {
		return state;
	}
	/**
	 * @param state the state to set
	 */
	public void setState(String state) {
		this.state = state;
	}
	/**
	 * @return the user
	 */
	@OneToOne(fetch=FetchType.LAZY, cascade={CascadeType.REFRESH}, mappedBy="shoppingCart")
	public BeanUser getUser() {
		return user;
	}
	/**
	 * @param user the user to set
	 */
	public void setUser(BeanUser user) {
		this.user = user;
	}
	/**
	 * @return the items
	 */
	@OneToMany(fetch=FetchType.LAZY, cascade={CascadeType.MERGE,CascadeType.REMOVE,CascadeType.PERSIST,CascadeType.REFRESH}, mappedBy="cart")
	public List<BeanShoppingCartItem> getItems() {
		return items;
	}
	/**
	 * @param items the items to set
	 */
	public void setItems(List<BeanShoppingCartItem> items) {
		this.items = items;
	}


	


}